﻿namespace EyeOpen.Security.Data.Nhibernate
{
    using System.Collections;
    using System.Linq;
    using EyeOpen.Domain;
    using EyeOpen.Security.Queries;
    using NHibernate;
    using NHibernate.Linq;

    internal class UserByEmailAndPasswordQueryTranslator
    {
        internal IEnumerable Execute(UserByEmailAndPasswordQuery query, ISession session)
        {
            return
                session
                .Linq<Credential>()
                .Where(c 
                    =>
                        c.Email == query.Email &&
                        c.Password == query.Password);
        }
    }
}
